import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from "@angular/router"; //这样能接收url中参数

@Component({
  selector: 'app-shoplist',
  templateUrl: './shoplist.component.html',
  styleUrls: ['./shoplist.component.css']
})
export class ShoplistComponent implements OnInit {

  constructor(private route:ActivatedRoute) { }//实例化路由跳转对象

  ngOnInit(): void {
    //this.route.params //这表示获取动态路由参数
    //this.route.queryParams //这表示获取get传值
    this.route.queryParams.subscribe(function (data){
      console.log(data)
    })
  }

}
